<?
include("common/header.html");
include("common/left.html");
include("common/page.php");
if($_SESSION['memberID']!=1){exit("<script>window.location='dlogin.html'</script>");}
$ac=$GLOBALS['_ac'];
$pw=$GLOBALS['_pw'];
$s = new SoapClient(null,array("location" => "http://localhost/open/openService/pft_insideMX.php","uri" => "www.16u.com?ac_16u=$ac|pw_16u=$pw|auth_16u=true"));
$id=$_REQUEST['id'];
$currentPage=$_REQUEST["currentPage"]?$_REQUEST["currentPage"]:1;
$pageSize=$_REQUEST['pageSize']?$_REQUEST["pageSize"]:20;
$op=$_REQUEST['op']?$_REQUEST["op"]:date("Y-m-d",strtotime("-1 month"));
$ed=$_REQUEST['ed']?$_REQUEST["ed"]:date("Y-m-d");
$_note=array();
$_a=simplexml_load_string($s->PFT_Member_Fund($id,0));
$tmoney=$_a->Rec[0]->UUamoney/100;
$sel="select count(*) tt from pft_member_journal j left join pft_member m on m.id=j.opid where rectime between '".$op." 00:00:00' and '".$ed." 23:59:59' and j.dtype=3 and aid in (".$id.",".$_SESSION['memberID'].",0) and j.fid=".$id;
$GLOBALS['le']->query($sel);
$GLOBALS['le']->fetch_assoc();
$total=$GLOBALS['le']->f('tt');
$sel="select account,dname from pft_member where id=".$id." limit 1";
$GLOBALS['le']->query($sel);
$GLOBALS['le']->fetch_assoc();
$dname=$GLOBALS['le']->f('dname');
$passport=$GLOBALS['le']->f('account');
$sel="select dname,rectime,j.dtype,daction,dmoney,lmoney,opid from pft_member_journal j left join pft_member m on m.id=j.opid where rectime between '".$op." 00:00:00' and '".$ed." 23:59:59' and j.dtype=3 and aid in (".$id.",".$_SESSION['memberID'].",0) and j.fid=".$id." order by rectime DESC limit ".($currentPage-1)*$pageSize.",".$pageSize;
$GLOBALS['le']->query($sel);
while($row=$GLOBALS['le']->fetch_assoc()){
	if($row['daction']=="0"){
		$row['add_c']=$row['dmoney']/100;
	}
	else{
		$row['redu_c']=$row['dmoney']/100;
	}
	switch($row['dtype']){
		case 0:$row['dreason']="下单";break;
		case 1:$row['dreason']="取消";break;
		case 3:$row['dreason']="账户资金变化";break;
		case 4:
			if($row['daction']=="0"){
				$row['dreason']=$row['opid']==$_SESSION['memberID']?"线下还款/预存":"分销商还款";
			}
			else{
				$row['dreason']="消费";
			}
			break;
		case 5:$row['dreason']="利润";break;
		case 6:$row['dreason']="提现或转账的资金冻结";break;
		case 7:$row['dreason']="平台使用费";break;
		case 8:$row['dreason']="短信息费";break;
		case 9:$row['dreason']="银行交易手续费";break;
		case 10:$row['dreason']="凭证费";break;
		case 11:$row['dreason']="供应商调整授信额度";break;
	}
	if($row['daction']=="0"){
		$row['add']=$row['dmoney']/100;
	}
	else{
		$row['redu']=$row['dmoney']/100;
	}
	$_note[]=$row;
}
include("tpl/repayment.html");
include("common/footer.html");
?>